package com.ruoyi.infoManagement.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.Regexregisteredservice;
import com.ruoyi.infoManagement.service.IRegexregisteredserviceService;
import com.ruoyi.infoManagement.service.RequestCasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
/*
原来是要用这个controller来获取另一个cas的controller的信息，返回给前端的
 */
//@RestController
//@RequestMapping("infoManagement/requestCas")
public class RequestCasController extends BaseController {
  @Autowired
  private RequestCasService requestCasService;
@Autowired
private IRegexregisteredserviceService iRegexregisteredserviceService;
  @PostMapping("/getServiceByName")
  public AjaxResult getServiceByName(@RequestBody Map map) {
    String name = map.get("name").toString();
    Regexregisteredservice regexregisteredservice=new Regexregisteredservice();
    regexregisteredservice.setName(name);

    List<Regexregisteredservice> list = iRegexregisteredserviceService.selectRegexregisteredserviceList(regexregisteredservice);
    return AjaxResult.success(list);
  }

  @PostMapping("/getServiceByUrl")
  public AjaxResult getServiceByUrl(@RequestBody Map map) {
    String logout = map.get("url").toString();
    Regexregisteredservice regexregisteredservice=new Regexregisteredservice();
    regexregisteredservice.setLogoutUrl(logout);
    List<Regexregisteredservice> list = iRegexregisteredserviceService.selectRegexregisteredserviceList(regexregisteredservice);
    return AjaxResult.success(list);
  }
}
